Partial Class pages_Files_File : Inherits CPage

#Region "Querystring"
    Public ReadOnly Property FileId() As Integer
        Get
            Dim id As Integer = CWeb.RequestInt("fileId")
            If id = Integer.MinValue Then CSitemap.RecordNotFound("File", id)
            Return id
        End Get
    End Property
#End Region

#Region "Data"
    Public ReadOnly Property [File]() As CFile
        Get
            Dim f As CFile = CFile.Cache.GetById(FileId)
            If IsNothing(f) Then CSitemap.RecordNotFound("File", FileId)
            Return f
        End Get
    End Property
#End Region

#Region "Event Handlers - Page"
    Protected Overrides Sub PageLoad()
        With Me.File
            txtFileName.Text = .FileName

            lnkFileProductId.Text = .Product.ProductName
            lnkFileProductId.NavigateUrl = CSitemap.ProductEdit(.FileProductId)

            txtFileSize.ValueInt = .FileSize
        End With
    End Sub
#End Region

End Class
